﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PresenterNamespace;
using LoggerNamespace;

namespace WPFView
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, IView
    {
        Presenter presenter;

        public MainWindow()
        {
            InitializeComponent();
            presenter = new Presenter((IView)this, (ILogger)(new HTMLLogger()));
        }

        public string result
        {
            get
            {
                return this.resultRichTextBox.Text;
            }
            set
            {
                this.resultRichTextBox.Text = value;
            }
        }
        public string addField
        {
            get
            {
                return this.addTextBox.Text;
            }
            set
            {
                this.addTextBox.Text = value;
            }
        }

        public void showLog(String str)
        {
            LogView logView = new LogView(str);
            logView.Show();
        }

        private void showLog_Click(object sender, RoutedEventArgs e)
        {
            presenter.showLog();
        }

        private void get_Click(object sender, RoutedEventArgs e)
        {
            presenter.getElement();
        }

        private void add_Click(object sender, RoutedEventArgs e)
        {
            presenter.addElement();
        }
    }
}
